1. Field of the Invention
The present invention relates generally to the compiling, loading, and execution of a computer program and, in particular, to the inclusion of extended information in a relocation directory for items that must be relocated into text before program execution, including information on the type of data involved in the relocation and an operation to be performed on the relocated item.
2. Description of the Related Art
Programmers write computer programs in high level languages such as FORTRAN and COBOL that include many descriptive terms that help the programmer write, structure, organize, and debug the program. This high level language program is referred to as the source code and includes data declarations and instructions which operate on that data. All addressing is symbolic, which means that the programmer assigns labels (names) to individual data elements and instructions to use throughout the program. Before the program can be executed, the source code must be transformed to machine readable executable code.
An assembler or compiler, referred to herein as a source translator, translates the source module into an object module, which includes machine readable executable code, data, external symbol definitions and references, address constants, and further bookkeeping information used in the process of transforming the object module into an executable file. Symbol references and address constants in one object module may reference text defined in another object module. The term xe2x80x9ctextxe2x80x9d as defined and used herein means data and/or code. A linkage editor combines one or more object or load modules into a load module in preparation for execution. Typically, the linkage editor combines object modules that contain a single definition of a symbol, i.e., symbol definition, and one or more references to the symbol, i.e., symbol references. If one object module includes a reference to an external symbol defined in another object module, then the linkage editor may resolve this reference with the definition in the load module.
Included in object modules are address constants. An address constant is a cell or field that is filled in later with information characterizing another location or module, such as its address. The information characterizing the referenced symbol will be relocated into the location of the address constant at translation time, bind time, or execution time. The object module includes information on the location of the address constant and the name of the referenced symbol. The referenced symbol can be internal or external to the object module which includes the address constant making the reference. Presently, the address constant is typically used to add the referenced address to the text at the location of the address constant in preparation for the relocation performed at execution time, when the load point of the program is known. The address constant may reference an external symbol. The address constant may contain other types of information, such as offsets, pseudo register vector lengths, constants, etc. During binding operations, the address defined by the external symbol may be relocated into the address constant location. This referenced information may also be relocated into the location of the address constant at execution time. The address constant may reference an external symbol. Further description of the types of address constants and their use is described in the International Business Machines Corporation (IBM) publication xe2x80x9cHigh Level Assembler for MVS and VM and VSE: Language Reference MVS and VM, Release 2,xe2x80x9d IBM document no SC26-4940-01 (Copyright IBM Corp., 1995), which publication is incorporated herein by reference in its entirety. Further details of object modules are described in the publication xe2x80x9cLinkers and Loaders,xe2x80x9d by Leon Presser and John R,. White, ACM Computing Surveys, Vol. 4, No. 32, September 1972, pp. 149-167, which is incorporated by reference herein in its entirety, and the commonly assigned U.S. patent entitled xe2x80x9cSystem and Method for Preparing a Computer Program for Execution,xe2x80x9d U.S. Pat. No. 5,553,286, which publication and patent are incorporated herein by reference in its entirety.
Current use of address constants provides only a limited range of operations that may be performed with respect to the referenced item and address constant. There is thus a need in the art for a more robust and flexible address constant that allows further operations to be performed with respect to the referenced item and location of the address constant.
Preferred embodiments are directed to a method, system and program for generating an executable file for execution by a computer. The computer receives a plurality of programming language statements comprising a source program. The computer translates the source program into an object module which includes a text portion and a fix-up target defining a location within the text portion. A relocation directory includes information indicating a referenced item; reference type information indicating a type of the referenced item; and operation type information indicating an operation performed on the referenced item and contents of the fix-up target. The computer then processes the reference type and the operation type information in the relocation directory and determines a result of performing the operation specified in the operation type information on the referenced item and the contents of the fix-up target. The computer then relocates into the location of the fix-up target the result of the operation performed on the referenced item and the contents of the fix-up target.
In further embodiments, the referenced item may comprise an address, an offset length, a pseudo register vector length, a numerical value, a set of data, a set of instructions, and a symbol.
In still further embodiments, the operation type information may indicate that the operation comprises addition, subtraction, negating the fix-up target, shifting, multiplication, division, logical AND, logical OR, logical XOR, and moving.
Preferred embodiments expand the types of reference items that may be relocated into the fix-up target field, i.e the address constant location, and the operations which may be performed on the referenced items. Further embodiments further add to the relocation directory to include information which describes the referenced item and the operations to be performed thereon, including information on the expanded operations and reference items of the present invention. In this way, preferred embodiments provide for expanded relocation types and operations to be performed thereon.